// large input. Output as demanded causes TLE

#include <iostream>
#include <cmath>

using namespace std;

int p[10001];

bool prime(int k)
{
	// 0 and 1 are prime numbers in this problem
	int sq = (int) sqrt(k); 
	for (int i = 2; i <= sq; i++)
		if (k % i == 0) return false;

	return true;
}

int main()
{
	p[0] = 0;
	for (int i = 0; i <= 10000; i++) 
		if (prime(i*i+i+41)) p[i+1] = p[i]+1;
		else p[i+1] = p[i];

	int a, b;
	while (cin >> a >> b)
	{
		printf("%.2f\n", (double) ((int) (((double) (p[b+1] - p[a]) / (b-a+1)) * 10000 + 0.5)) / 100);
	}
	return 0;
}
